﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace FluentETL.Impl
{
    public class CompositeRow: DictionaryRow
    {
        public CompositeRow() : base()
        {
        }

        public CompositeRow AddRow(IRow row, bool ignoreDuplicateField)
        {
            foreach (string field in row.Fields)
            {
                if (Values.ContainsKey(field) && !ignoreDuplicateField)
                    throw new InvalidOperationException("A field named '" + field + "' already exists.");
                this.Values[field] = row[field];
            }
            return this;
        }
    }
}